import {defineComponent, PropType} from "vue";
import {ElImage, ElIcon} from "element-plus"

export default defineComponent({
    name: "CdlImage",
    props: {
        src: {type: String, required: true},
        previewSrcList: {type: Object as PropType<string[]>, required: true},
    },

    setup(props, {slots, expose}){
        return () =>(
            <ElImage style="width: 100px; height: 100px"
                     src={props.src}
                     zoom-rate={1.2}
                     max-scale={7}
                     min-scale={0.2}
                     preview-src-list={props.previewSrcList}
                     initial-index={4}
                     preview-teleported={true}
                     fit="cover" v-slots={{
                        error: ()=> <div class="image-slot">
                            <ElIcon>
                                暂无图片
                            </ElIcon>
                    </div>
            }}>
            </ElImage>)
    }
})
